Cocojunk

🚀 Dive deep with CocoJunk – your destination for detailed, well-researched articles across science, technology, culture, and more. Explore knowledge that matters, explained in plain English.

Navigation: Home

Read-only memory

Published: Sat May 03 2025 19:14:06 GMT+0000 (Coordinated Universal Time) Last Updated: 5/3/2025, 7:14:06 PM

Read the original article here.


Okay, here is the detailed educational resource on Read-Only Memory (ROM), tailored for the context of "The Lost Art of Building a Computer from Scratch."


Read-Only Memory (ROM): The Unchanging Instructions

In the journey of building a computer from scratch, understanding the fundamental building blocks is crucial. Among these is memory, the component that stores data and instructions the computer needs to operate. While Random Access Memory (RAM) is often discussed for its role in holding actively used data, Read-Only Memory (ROM) serves a distinct and equally vital purpose, especially in getting the machine started and holding core, unchangeable instructions.

Definition: Memory A computer component that stores digital data, typically instructions or program data. Memory can be volatile (loses data when power is removed) or non-volatile (retains data when power is removed).

Definition: Non-Volatile Memory A type of computer memory that can retain stored information even when not powered. This is in contrast to volatile memory, which requires power to maintain the stored information.

ROM, at its core, is a type of non-volatile memory. The defining characteristic, historically and strictly speaking, is that data stored in ROM is permanent or very difficult to change after the memory device is manufactured or programmed. This makes it ideal for storing instructions that are essential for the computer's basic operation and are not expected to change during its lifetime, often referred to as firmware.

Definition: Firmware A specific type of software that provides low-level control for a device's specific hardware. Firmware is often stored in non-volatile memory like ROM, EPROM, EEPROM, or Flash memory, allowing it to persist even when the device is powered off. It essentially bridges the gap between hardware and higher-level software like operating systems.

While the strict definition of ROM refers to devices hard-wired during manufacturing, the term has evolved. Modern "ROM" often refers to non-volatile, even re-programmable memory technologies used for similar purposes, like storing firmware. Understanding this evolution is key to grasping its role from early computers to modern systems.

ROM vs. RAM: A Fundamental Distinction

When building a computer, you'll encounter both RAM and ROM. It's essential to understand their fundamental differences:

  • Volatility: RAM is volatile; it loses all its data when power is removed. ROM is non-volatile; it retains its data without power.
  • Purpose: RAM is primarily for temporary storage of data and programs currently being used by the CPU. ROM is primarily for permanent storage of essential instructions (like boot-up sequences or firmware) that don't change frequently.
  • Access Speed: Historically, RAM has generally been faster for both reading and writing than ROM (especially writing). However, modern flash-based "ROM" technologies have significantly closed this gap, particularly for reading.
  • Cost per Bit (Historically): For many years, mask ROM offered a lower cost-per-bit than RAM, making it economical for storing large, unchanging programs in simpler devices.

A Historical Look: The Evolution of ROM

Understanding the history of ROM shows how the need for permanent, easily accessible instructions evolved alongside computing technology.

Discrete-Component ROM (Early Days)

Before integrated circuits (ICs), ROM was built using individual components. This highlights the fundamental concept: creating a physical structure that represents data and can only be "read".

  • Diode Matrix ROM: Imagine a grid of wires. Some horizontal "word lines" and vertical "bit lines". At certain intersections, a diode might be present or absent. When a word line is energized (addressed), current flows through the diodes connected to it, causing a voltage on the corresponding bit lines, which is interpreted as data (e.g., presence = 1, absence = 0). This was a simple, physical way to hard-wire data. Used in early calculators and computer sub-systems.
  • Resistor/Capacitor Matrix ROM: Similar grid principle to diode matrix, but using resistors or capacitors instead of diodes at intersections. The ENIAC, one of the earliest electronic computers, used resistor matrix "Function Tables" programmed by setting rotary switches – a very manual, slow form of ROM programming! IBM used capacitor (CCROS, BCROS) and transformer (TROS) matrices in some System/360 models for microcode storage.
  • Core Rope Memory: A more complex form used where space and reliability were critical, famously in the Apollo Guidance Computer. Data was stored by physically threading wires (sense lines) through or around magnetic cores (which acted like transformers coupled to drive lines). Threading through a core might represent a '1', threading around might represent a '0'. Programming involved literally hand-weaving wires, making it highly reliable but impossible to change after assembly.

Additional Context: Microcode Microcode is a layer of low-level instructions embedded in the hardware of many processors. It interprets and executes the higher-level machine code instructions that programmers write or compilers generate. Storing microcode in ROM ensured these fundamental operations were always available when the processor powered on.

These early forms were truly "read-only" in the sense that changing the data required physically altering the wiring or components.

Solid-State ROM (The IC Era)

The invention of the integrated circuit revolutionized ROM, making it smaller, faster, and eventually, re-programmable.

  1. Mask ROM: The first IC form of ROM. Data is programmed during the manufacturing process using a "photomask". This mask determines the presence or absence of connections (like transistors) at specific points on the silicon wafer. These connections physically encode the data.

    • How it works (Simplified): In a common NOR configuration, the mask might determine if a transistor connects a bit line to ground (representing a '0') when its word line is activated. If the connection is missing, the bit line remains high (representing a '1').
    • Advantages:
      • Lowest Cost per Bit (in volume): Since the data is a physical part of the chip's structure, a mask ROM cell is typically very simple (often just one transistor or its absence), making it the densest and cheapest form of semiconductor memory if manufactured in large quantities.
      • Fast Read Speed: Data is hard-wired, leading to predictable and often fast access times.
      • High Reliability: No wear mechanisms like those in reprogrammable memory.
    • Disadvantages:
      • High Initial Mask Cost: Creating the custom photomask is expensive.
      • Long Turnaround Time: Designing the mask, manufacturing the chip, and testing takes time.
      • Impossible to Change: If there's a bug in the data or firmware, the entire chip is useless. The only fix is to manufacture a new batch with a corrected mask. This was a major risk for products shipped with faulty mask ROM.
      • Impractical for Development: Designers couldn't easily test code revisions by changing the ROM.
  2. Programmable Read-Only Memory (PROM) / One-Time Programmable (OTP): Invented to address the mask ROM's inflexibility during design and for lower volumes.

    • How it works: PROM chips contain intact fuses or anti-fuses at each bit location. A special device called a PROM programmer applies high-voltage pulses to "blow" the fuses (creating an open circuit, representing one state) or "create" anti-fuses (creating a connection, representing the other state) according to the desired data. Once a fuse is blown or an anti-fuse created, it's permanent.
    • Advantages: Can be programmed by the user/manufacturer after the chip is fabricated. This reduced the cost and turnaround time compared to mask ROM for small to medium production runs and development.
    • Disadvantages: Can only be programmed once. Still not flexible for debugging or updates that require multiple changes.

Definition: PROM Programmer An electronic device used to write data into a PROM chip. It applies specific voltage and timing signals to permanently alter the physical structure (fuses/anti-fuses) within the chip, encoding the desired data.

  1. Erasable Programmable Read-Only Memory (EPROM): A major leap forward, adding the ability to erase and reprogram the chip.

    • How it works: EPROM uses transistors with "floating gates" covered by an insulating layer. To program a bit, high voltage is applied, forcing electrons onto the floating gate, where they become trapped, altering the transistor's properties and representing a '1' or '0'. To erase, the entire chip is exposed to strong ultraviolet (UV) light (via a quartz window on the chip package). The UV light provides energy that allows the trapped electrons to escape from the floating gates, returning the chip to its unprogrammed state (all bits typically '1').
    • Advantages: Re-programmable, allowing for debugging, updates, and use in development cycles.
    • Disadvantages: Requires a UV eraser and a PROM programmer. Erasure takes time (minutes). The entire chip must be erased. Endurance is limited (typically 1,000 erase/program cycles). The window adds cost and requires covering after programming to prevent accidental erasure.
  2. Electrically Erasable Programmable Read-Only Memory (EEPROM): Improving on EPROM by allowing electrical erasure.

    • How it works: Similar floating-gate technology to EPROM, but incorporates circuitry on the chip itself to allow electrical removal of electrons from the floating gates, bit by bit, byte by byte, or in larger blocks. This is done by applying voltages higher than normal read voltage but lower than the high programming voltages of EPROM.
    • Advantages: Can be erased and reprogrammed electrically, often while still installed in the circuit ("in-place programming"). Does not require a UV eraser or a window. More convenient for updates.
    • Disadvantages: Writing/erasing is significantly slower than reading. Endurance is still limited (though typically higher than early EPROM, often 10,000 to 100,000 cycles). More complex circuitry than EPROM, making it slightly less dense or more expensive initially. EAROM (Electrically Alterable ROM) was an early type of EEPROM that allowed changing just a few bits at a time, but was very slow to write.
  3. Flash Memory: A modern, high-density form of EEPROM.

    • How it works: Also uses floating gates but is organized differently, allowing for block-level erasure (hence "flash" – fast erasure of a block) and faster programming than traditional EEPROM. Two main types emerged:
      • NOR Flash: Allows random access reading (like traditional ROM/RAM) and is good for storing code that needs to be executed directly from the flash chip. Used for firmware (BIOS/UEFI), microcontroller code.
      • NAND Flash: Organized serially in blocks, making random access reads slower but sequential reads/writes much faster and allowing for much higher density. Primarily used for mass storage (USB drives, SSDs, SD cards) – effectively replacing magnetic disks in many applications.
    • Advantages: High density (especially NAND), faster erase/program cycles than older EEPROM, higher endurance (millions of cycles for some types), lower power consumption. Can be updated easily in-place.
    • Disadvantages: Writing is still slower than reading. Endurance is finite (though high). Error correction is often needed, especially with multi-level cell (MLC, TLC, QLC) NAND flash that stores more than one bit per cell, as they are more susceptible to errors over time and write cycles.

This progression shows a clear trend: from permanent, factory-set data to increasingly flexible, user-programmable, and eventually high-density, fast-writing non-volatile storage.

The Role of ROM in Building a Computer

So, why is ROM (or its modern equivalents) essential when building a computer? Its non-volatile nature is key.

Bootstrapping: Getting Started

The first crucial step when you turn on a computer is to execute some code that initializes the hardware and loads the operating system. This initial code cannot reside in RAM because RAM is empty when the power comes on. It must be stored in non-volatile memory. This process is called bootstrapping or booting.

Definition: Bootstrapping (Booting) The process by which a computer starts up. It involves a small, initial program (often stored in ROM or flash memory) that initializes the hardware, performs basic checks, and loads the main operating system into RAM for execution.

Historically:

  • Early Home Computers (e.g., Commodore 64): Entire operating systems and even programming languages (like BASIC) were stored in ROM because other non-volatile storage (like floppy drives) was expensive. The computer would boot directly into the BASIC interpreter or OS prompt from ROM.
  • IBM PC and Early PCs: Moved towards loading the OS from disk into RAM. ROM contained the BIOS (Basic Input/Output System). The BIOS's job was to:
    • Perform a Power-On Self-Test (POST) to check hardware.
    • Initialize basic devices.
    • Find a bootable device (like a floppy drive or hard disk).
    • Load the boot sector from the device into RAM.
    • Transfer control to the boot sector code, which would then load the rest of the operating system.
    • Provide a set of basic hardware access routines for the OS or applications before full drivers were loaded.

Definition: BIOS (Basic Input/Output System) Firmware historically used in IBM PC compatible computers to perform hardware initialization during the booting process, and to provide runtime services for operating systems and programs. Typically stored in ROM or flash memory.

  • Modern PCs: BIOS has largely been replaced by UEFI (Unified Extensible Firmware Interface), which is more complex and capable but serves the same fundamental purpose of initializing hardware and booting an operating system. UEFI is also stored in flash memory.

Definition: UEFI (Unified Extensible Firmware Interface) A software interface between an operating system and platform firmware. UEFI replaces the legacy BIOS and provides a more modern environment for booting operating systems and running pre-boot applications. It is typically stored in flash memory.

So, when building a computer from scratch, the ROM (or flash chip containing UEFI/BIOS) is the very first part of the system that the CPU interacts with after power-up. It contains the instructions that tell the CPU what to do before it can load anything from a storage device.

Storing Firmware for Peripherals

Beyond the main system BIOS/UEFI, many peripheral devices also contain their own firmware stored in ROM or flash memory. This includes:

  • Graphics cards
  • Network cards
  • Hard disk drives and SSDs (controllers within the drive have firmware)
  • Optical drives
  • Keyboards and mice
  • Microcontrollers in embedded systems (appliances, cars, industrial equipment)

This firmware allows the device to function and communicate with the main system. Updates to this firmware are often done by "flashing" the new code into the device's built-in flash memory.

Embedded Systems

ROM and flash memory are particularly prevalent in embedded systems – dedicated computer systems designed for specific functions (e.g., inside a washing machine, a smart TV, a medical device). These systems often lack traditional hard drives. The entire operating system and application software for the device are typically stored in flash memory or sometimes mask ROM for very high-volume, cost-sensitive applications where the code is stable.

Storing Static Data

Historically, ROM was also used to store static data that the computer needed, such as:

  • Look-up Tables: Tables of values for mathematical functions (e.g., sine, cosine) to speed up calculations before powerful floating-point units were common.
  • Character Fonts: Early graphics cards stored bitmap patterns for text characters in ROM, defining how letters and numbers looked on the screen. This is why changing the text font was often impossible without changing the hardware.

In modern systems, storing large static data sets in ROM is less common for general-purpose computing, as RAM is large and fast, and data can be loaded quickly from mass storage. However, flash memory is now the primary medium for that mass storage itself!

Performance Considerations: Speed and Shadowing

While ROM is non-volatile, historically, its read speed was often slower than RAM. Writing to reprogrammable ROM (PROM, EPROM, EEPROM, Flash) was significantly slower than reading or writing to RAM.

  • Reading Speed: Early ROM technologies could be slower to access than contemporary RAM. To mitigate this, a technique called shadowing was often used. The contents of the ROM (e.g., the BIOS) would be copied into faster RAM during the boot process. Subsequent reads would then access the RAM copy, speeding up execution. This concept is less critical today as modern flash memory read speeds are much closer to RAM speeds.

Definition: Shadowing (Memory Shadowing) A technique where the contents of a slower memory (like ROM) are copied into faster memory (like RAM) at system startup. Subsequent read operations are then directed to the faster RAM copy, improving performance.

  • Writing Speed: Reprogramming ROM types involves different mechanisms than reading. PROM programming requires high-voltage pulses to blow fuses. EPROM/EEPROM/Flash writing involves moving electrons onto floating gates, which is a slower process than the simple voltage sensing used for reading. Modern NAND flash, while still slower to write than RAM, has achieved remarkable write speeds (GB/s in SSDs) through parallelization, large caches, and complex controllers, blurring the lines between traditional "ROM" and mass storage.

Reliability: Endurance and Data Retention

Two key reliability factors for ROM, particularly the reprogrammable types, are endurance and data retention.

  • Endurance: Reprogrammable ROMs (especially floating-gate types like EPROM, EEPROM, and Flash) have a limited number of write/erase cycles they can withstand before the insulating layers degrade and the memory cells fail.

    • Early EPROMs: ~1,000 cycles.
    • EEPROMs: ~10,000 to 100,000 cycles.
    • Flash Memory: Typically 100,000 to over 1,000,000 cycles for higher-quality types.
    • Mask ROM and Fuse-based PROM/OTP do not have write endurance limits because the data is physically permanent. This limited endurance is why Flash is not a direct replacement for RAM for active, continuous writing, although it is excellent for storing data that changes less frequently or is managed by wear-leveling algorithms (as in SSDs).
  • Data Retention: This refers to how long the stored data remains reliable without power. For floating-gate technologies (EPROM, EEPROM, Flash), charge can slowly leak off the floating gates over time, especially at high temperatures or under radiation.

    • Early EEPROMs: Data retention might be specified as 5-6 years.
    • Modern EEPROMs/Flash: Manufacturers often specify 10, 20, or even 100 years of data retention under normal conditions.
    • Mask ROM and Fuse-based PROM are generally not subject to charge leakage and retain data as long as the physical structure of the chip remains intact.

ROM Images: Software Representations

The term "ROM" has also come to refer to software files containing the data intended to be stored in a ROM chip.

Definition: ROM Image (or simply "ROM") A digital file containing a copy of the data from a ROM chip, often extracted using specialized hardware. Used for backup, analysis, emulation, or programming new ROM chips.

This term originated with video game cartridges, which often contained Mask ROM or PROM chips holding the game software. Extracting the game data resulted in a "ROM image" file. The term is now widely used for any file containing firmware or software from non-volatile memory, even if the original medium was Flash, CD-ROM, or another type.

ROM images are crucial for:

  • Archival and Preservation: Saving firmware from older systems or rare devices.
  • Emulation: Running software designed for specific hardware (like vintage game consoles) on different platforms (like modern PCs) by loading the ROM image into an emulator program.
  • Customization/Modding: Creating modified versions of firmware or operating systems (e.g., "custom ROMs" for Android devices).

While convenient, distributing copyrighted ROM images without authorization is illegal in most places.

Conclusion: ROM's Enduring Legacy

From hand-wired matrices and physical masks to advanced floating-gate technologies, Read-Only Memory has been a fundamental component in computers for decades. Its core function – providing stable, non-volatile storage for essential instructions and data – remains critical.

When building a computer from scratch, even a relatively modern one, you'll encounter "ROM" in the form of the flash memory chip holding the BIOS/UEFI firmware. Understanding its purpose, historical evolution, and the trade-offs between different technologies provides crucial insight into how computers start up and manage their basic operations, laying a foundation for understanding more complex aspects of system design. While the technology has changed dramatically, the fundamental need for a reliable, non-volatile store of initial instructions persists.

Related Articles

See Also